package nl.tygron.niftyconverter.elements;

import org.w3c.dom.Element;

/**
 * @author Raymond Weijermars
 * @Specialism GUI
 * @Maintainer Jeroen Warmerdam
 */

public class NButtonNoImageElement extends NElement {

	/**
	 * <image id="continue" filename="/Images/menu_narrow_inverse_out.png" visibleToMouse="true" x="760" y="600"> <effect> <onHover
	 * name="imageOverlay" filename="Interface/Nifty/Images/menu_narrow_inverse_over.png" post="true"/> </effect> <interact onClick="cont()"
	 * /*
	 */

	protected Element elementEffect;
	protected Element elementOnHover;
	protected Element elementInteract;
	protected NTextElement nTextElement;

	/**
	 * Constructor for image buttons without a textlabel.
	 */
	public NButtonNoImageElement(String id, int x, int y, int panelWidth, int panelHeight, NiftyStructure nStructure, String align,
	        String valign) {

		super(id + "Panel", x, y, panelWidth, panelHeight, nStructure.newElement("panel"));
		initStandardNButtonElements(id, nStructure);
	}

	private void initStandardNButtonElements(String id, NiftyStructure nStructure) {

		this.addAttribute("childClip", "true");
		elementEffect = nStructure.newElement("effect");
		element.appendChild(elementEffect);
		element.setAttribute("visibleToMouse", "true");
		elementInteract = nStructure.newElement("interact");
		elementInteract.setAttribute("onRelease", "buttonClicked(" + id + ")");
		element.appendChild(elementInteract);
	}
}
